/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Daniel Cruz
 */
@Entity
@Table(name = "b_basica_tipo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BBasicaTipo.findAll", query = "SELECT b FROM BBasicaTipo b"),
    @NamedQuery(name = "BBasicaTipo.findByBatId", query = "SELECT b FROM BBasicaTipo b WHERE b.batId = :batId"),
    @NamedQuery(name = "BBasicaTipo.findByBatBtbCod", query = "SELECT b FROM BBasicaTipo b WHERE b.batBtbCod = :batBtbCod"),
    @NamedQuery(name = "BBasicaTipo.findByBatNombre", query = "SELECT b FROM BBasicaTipo b WHERE b.batNombre = :batNombre"),
    @NamedQuery(name = "BBasicaTipo.findByBatDescripcion", query = "SELECT b FROM BBasicaTipo b WHERE b.batDescripcion = :batDescripcion"),
    @NamedQuery(name = "BBasicaTipo.findByBatEstado", query = "SELECT b FROM BBasicaTipo b WHERE b.batEstado = :batEstado"),
    @NamedQuery(name = "BBasicaTipo.findByBatOrden", query = "SELECT b FROM BBasicaTipo b WHERE b.batOrden = :batOrden"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc1", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc1 = :batDesc1"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc2", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc2 = :batDesc2"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc3", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc3 = :batDesc3"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc4", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc4 = :batDesc4"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc5", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc5 = :batDesc5"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc6", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc6 = :batDesc6"),
    @NamedQuery(name = "BBasicaTipo.findByBatDesc7", query = "SELECT b FROM BBasicaTipo b WHERE b.batDesc7 = :batDesc7")})
public class BBasicaTipo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "bat_id")
    private Long batId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "bat_btb_cod")
    private String batBtbCod;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "bat_nombre")
    private String batNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "bat_descripcion")
    private String batDescripcion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "bat_estado")
    private String batEstado;
    @Column(name = "bat_orden")
    private Long batOrden;
    @Size(max = 255)
    @Column(name = "bat_desc1")
    private String batDesc1;
    @Size(max = 255)
    @Column(name = "bat_desc2")
    private String batDesc2;
    @Size(max = 255)
    @Column(name = "bat_desc3")
    private String batDesc3;
    @Size(max = 255)
    @Column(name = "bat_desc4")
    private String batDesc4;
    @Size(max = 255)
    @Column(name = "bat_desc5")
    private String batDesc5;
    @Size(max = 255)
    @Column(name = "bat_desc6")
    private String batDesc6;
    @Size(max = 255)
    @Column(name = "bat_desc7")
    private String batDesc7;
    @JoinTable(name = "accesorio", joinColumns = {
        @JoinColumn(name = "bat_id_adicional_acc", referencedColumnName = "bat_id")}, inverseJoinColumns = {
        @JoinColumn(name = "id_lib_acc", referencedColumnName = "id_lib")})
    @ManyToMany
    private Collection<Libro> libroCollection;
    @OneToMany(mappedBy = "batIdPais")
    private Collection<Autor> autorCollection;
    @OneToMany(mappedBy = "batIdPaisEditorial")
    private Collection<Editorial> editorialCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "prsBatTipoDoc")
    private Collection<BPersona> bPersonaCollection;
    @OneToMany(mappedBy = "batIdNivelLecturaLib")
    private Collection<Libro> libroCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "batIdGeneroLib")
    private Collection<Libro> libroCollection2;
    @OneToMany(mappedBy = "parenBatId")
    private Collection<BBasicaTipo> bBasicaTipoCollection;
    @JoinColumn(name = "paren_bat_id", referencedColumnName = "bat_id")
    @ManyToOne
    private BBasicaTipo parenBatId;
    @JoinColumn(name = "btb_id", referencedColumnName = "btb_id")
    @ManyToOne(optional = false)
    private BBasicTabl btbId;
    @OneToMany(mappedBy = "batIdIdiomaMat")
    private Collection<Material> materialCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "batIdSalaMat")
    private Collection<Material> materialCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "batIdCargo")
    private Collection<BEmpleado> bEmpleadoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "batIdTipoAdquicicion")
    private Collection<Ejemplar> ejemplarCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "batIdAudConocimiento")
    private Collection<Audiovisual> audiovisualCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "batIdAudTipo")
    private Collection<Audiovisual> audiovisualCollection1;

    public BBasicaTipo() {
    }

    public BBasicaTipo(Long batId) {
        this.batId = batId;
    }

    public BBasicaTipo(Long batId, String batBtbCod, String batNombre, String batDescripcion, String batEstado) {
        this.batId = batId;
        this.batBtbCod = batBtbCod;
        this.batNombre = batNombre;
        this.batDescripcion = batDescripcion;
        this.batEstado = batEstado;
    }

    public Long getBatId() {
        return batId;
    }

    public void setBatId(Long batId) {
        this.batId = batId;
    }

    public String getBatBtbCod() {
        return batBtbCod;
    }

    public void setBatBtbCod(String batBtbCod) {
        this.batBtbCod = batBtbCod;
    }

    public String getBatNombre() {
        return batNombre;
    }

    public void setBatNombre(String batNombre) {
        this.batNombre = batNombre;
    }

    public String getBatDescripcion() {
        return batDescripcion;
    }

    public void setBatDescripcion(String batDescripcion) {
        this.batDescripcion = batDescripcion;
    }

    public String getBatEstado() {
        return batEstado;
    }

    public void setBatEstado(String batEstado) {
        this.batEstado = batEstado;
    }

    public Long getBatOrden() {
        return batOrden;
    }

    public void setBatOrden(Long batOrden) {
        this.batOrden = batOrden;
    }

    public String getBatDesc1() {
        return batDesc1;
    }

    public void setBatDesc1(String batDesc1) {
        this.batDesc1 = batDesc1;
    }

    public String getBatDesc2() {
        return batDesc2;
    }

    public void setBatDesc2(String batDesc2) {
        this.batDesc2 = batDesc2;
    }

    public String getBatDesc3() {
        return batDesc3;
    }

    public void setBatDesc3(String batDesc3) {
        this.batDesc3 = batDesc3;
    }

    public String getBatDesc4() {
        return batDesc4;
    }

    public void setBatDesc4(String batDesc4) {
        this.batDesc4 = batDesc4;
    }

    public String getBatDesc5() {
        return batDesc5;
    }

    public void setBatDesc5(String batDesc5) {
        this.batDesc5 = batDesc5;
    }

    public String getBatDesc6() {
        return batDesc6;
    }

    public void setBatDesc6(String batDesc6) {
        this.batDesc6 = batDesc6;
    }

    public String getBatDesc7() {
        return batDesc7;
    }

    public void setBatDesc7(String batDesc7) {
        this.batDesc7 = batDesc7;
    }

    @XmlTransient
    public Collection<Libro> getLibroCollection() {
        return libroCollection;
    }

    public void setLibroCollection(Collection<Libro> libroCollection) {
        this.libroCollection = libroCollection;
    }

    @XmlTransient
    public Collection<Autor> getAutorCollection() {
        return autorCollection;
    }

    public void setAutorCollection(Collection<Autor> autorCollection) {
        this.autorCollection = autorCollection;
    }

    @XmlTransient
    public Collection<Editorial> getEditorialCollection() {
        return editorialCollection;
    }

    public void setEditorialCollection(Collection<Editorial> editorialCollection) {
        this.editorialCollection = editorialCollection;
    }

    @XmlTransient
    public Collection<BPersona> getBPersonaCollection() {
        return bPersonaCollection;
    }

    public void setBPersonaCollection(Collection<BPersona> bPersonaCollection) {
        this.bPersonaCollection = bPersonaCollection;
    }

    @XmlTransient
    public Collection<Libro> getLibroCollection1() {
        return libroCollection1;
    }

    public void setLibroCollection1(Collection<Libro> libroCollection1) {
        this.libroCollection1 = libroCollection1;
    }

    @XmlTransient
    public Collection<Libro> getLibroCollection2() {
        return libroCollection2;
    }

    public void setLibroCollection2(Collection<Libro> libroCollection2) {
        this.libroCollection2 = libroCollection2;
    }

    @XmlTransient
    public Collection<BBasicaTipo> getBBasicaTipoCollection() {
        return bBasicaTipoCollection;
    }

    public void setBBasicaTipoCollection(Collection<BBasicaTipo> bBasicaTipoCollection) {
        this.bBasicaTipoCollection = bBasicaTipoCollection;
    }

    public BBasicaTipo getParenBatId() {
        return parenBatId;
    }

    public void setParenBatId(BBasicaTipo parenBatId) {
        this.parenBatId = parenBatId;
    }

    public BBasicTabl getBtbId() {
        return btbId;
    }

    public void setBtbId(BBasicTabl btbId) {
        this.btbId = btbId;
    }

    @XmlTransient
    public Collection<Material> getMaterialCollection() {
        return materialCollection;
    }

    public void setMaterialCollection(Collection<Material> materialCollection) {
        this.materialCollection = materialCollection;
    }

    @XmlTransient
    public Collection<Material> getMaterialCollection1() {
        return materialCollection1;
    }

    public void setMaterialCollection1(Collection<Material> materialCollection1) {
        this.materialCollection1 = materialCollection1;
    }

    @XmlTransient
    public Collection<BEmpleado> getBEmpleadoCollection() {
        return bEmpleadoCollection;
    }

    public void setBEmpleadoCollection(Collection<BEmpleado> bEmpleadoCollection) {
        this.bEmpleadoCollection = bEmpleadoCollection;
    }

    @XmlTransient
    public Collection<Ejemplar> getEjemplarCollection() {
        return ejemplarCollection;
    }

    public void setEjemplarCollection(Collection<Ejemplar> ejemplarCollection) {
        this.ejemplarCollection = ejemplarCollection;
    }

    @XmlTransient
    public Collection<Audiovisual> getAudiovisualCollection() {
        return audiovisualCollection;
    }

    public void setAudiovisualCollection(Collection<Audiovisual> audiovisualCollection) {
        this.audiovisualCollection = audiovisualCollection;
    }

    @XmlTransient
    public Collection<Audiovisual> getAudiovisualCollection1() {
        return audiovisualCollection1;
    }

    public void setAudiovisualCollection1(Collection<Audiovisual> audiovisualCollection1) {
        this.audiovisualCollection1 = audiovisualCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (batId != null ? batId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BBasicaTipo)) {
            return false;
        }
        BBasicaTipo other = (BBasicaTipo) object;
        if ((this.batId == null && other.batId != null) || (this.batId != null && !this.batId.equals(other.batId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.BBasicaTipo[ batId=" + batId + " ]";
    }
    
}
